<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>WebGl Training</title>
<script src="js/Three.js" type="text/javascript" ></script>
<script>

	var camera, scene, renderer, geometry, material, mesh;
		
    function init() {
        scene = new THREE.Scene();

        camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
        camera.position.z = 1000;
        scene.add( camera );

        geometry = new THREE.CubeGeometry( 200, 200, 200 );
        material = new THREE.MeshBasicMaterial( { color: 0x00ff00, wireframe: true } );

        mesh = new THREE.Mesh( geometry, material );
        scene.add( mesh );

        renderer = new THREE.WebGLRenderer();
        //renderer.setSize( window.innerWidth, window.innerHeight );
		renderer.setSize( window.innerWidth-20, window.innerHeight-20);

        document.body.appendChild( renderer.domElement );

    }

    function animate() {

        // note: three.js includes requestAnimationFrame shim
        requestAnimationFrame( animate );
        render();

    }

    function render() {

        mesh.rotation.x += 0.02;
        mesh.rotation.y += 0.02;
		mesh.rotation.z += 0.02;

        renderer.render( scene, camera );

    }
	
	function afterLoad(){
		init();
	    animate();
	}
</script>
</head>

<body onload="afterLoad();">
</body>
</html>